package c1759;

import java.util.*;
public class D {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNext()){
		    int n=cin.nextInt();
		    if(n==0)break;
		    int [] arr=new int[n];
		    for(int i=0;i<n;i++){
		        arr[i]=cin.nextInt();
		    }
		    int s=0;
		    for(int i=0;i<n;i++){
		        s+=arr[i];
		    }
		    System.out.println(s);
		    
		}
		cin.close();
	}
}